#include<bits/stdc++.h>
using namespace std;
int main()
{
    freopen("road.in","r",stdin);
    freopen("road.out","w",stdout);
    int n;
    scanf("%d",&n);
    n++;
    int maxx=0;
    while((1<<maxx+1)<=n)
        maxx++;
    vector<tuple<int,int,int> >edge;
    for(int i=0;i<maxx;i++)
    {
        edge.push_back(make_tuple(i+2,i+3,(1<<maxx-i-1)));
        edge.push_back(make_tuple(i+2,i+3,0));
    }
    edge.push_back(make_tuple(maxx+2,114,0));
    for(int i=maxx,res=0;~i;i--)
        if(n>>i&1)
        {
            edge.push_back(make_tuple(1,maxx-i+2,res));
            res+=1<<i;
        }
    printf("%d %d\n",maxx+3,edge.size());
    for(int i=0;i<edge.size();i++)
        printf("%d %d %d\n",get<0>(edge[i]),get<1>(edge[i]),get<2>(edge[i]));
    return 0;
}